impl->id);
}
-static cairo_surface_t *
+static gboolean
gdk_window_broadway_resize_cairo_surface (GdkWindow *window,
cairo_surface_t *surface,
gint width,
gint height)
{
/* Image surfaces cannot be resized */
- cairo_surface_destroy (surface);
-
- return NULL;
+ return FALSE;
}
static void
return FALSE;
}
-static cairo_surface_t *
+static gboolean
gdk_offscreen_window_resize_cairo_surface (GdkWindow *window,
cairo_surface_t *surface,
gint width,
/* No-op. The surface gets resized in
* gdk_offscreen_window_move_resize_internal().
*/
- return surface;
+ return TRUE;
}
/**
}
}
- if (private->cairo_surface && gdk_window_has_impl (private))
+ if (private->cairo_surface)
{
- GdkWindowImplClass *iface = GDK_WINDOW_IMPL_GET_CLASS (private->impl);
-
- private->cairo_surface = iface->resize_cairo_surface (private,
- private->cairo_surface,
- private->width,
- private->height);
+ if (!gdk_window_has_impl (private) ||
+ !GDK_WINDOW_IMPL_GET_CLASS (private->impl)->resize_cairo_surface (private,
+ private->cairo_surface,
+ private->width,
+ private->height))
+ {
+ gdk_window_drop_cairo_surface (private);
+ }
}
- else if (private->cairo_surface)
- gdk_window_drop_cairo_surface (private);
}
/* Call this when private has changed in one or more of these ways:
*/
void (*destroy_foreign) (GdkWindow *window);
- cairo_surface_t * (* resize_cairo_surface) (GdkWindow *window,
- cairo_surface_t *surface,
- gint width,
- gint height);
+ /* Resizes @surface to a new size. If successful, return %TRUE.
+ * If the backend cannot resize surfaces, return %FALSE and a new
+ * surface will be created instead.
+ */
+ gboolean (* resize_cairo_surface) (GdkWindow *window,
+ cairo_surface_t *surface,
+ gint width,
+ gint height);
/* optional */
gboolean (* beep) (GdkWindow *window);
}
}
-static cairo_surface_t *
+static gboolean
gdk_window_quartz_resize_cairo_surface (GdkWindow *window,
cairo_surface_t *surface,
gint width,
gint height)
{
/* Quartz surfaces cannot be resized */
- cairo_surface_destroy (surface);
-
- return NULL;
+ return FALSE;
}
static void
{
}
-static cairo_surface_t *
+static gboolean
gdk_window_wayland_resize_cairo_surface (GdkWindow *window,
cairo_surface_t *surface,
gint width,
gint height)
{
/* cairo image surfaces cannot be resized */
- return NULL;
+ return FALSE;
}
static cairo_region_t *
}
}
-static cairo_surface_t *
+static gboolean
gdk_win32_window_resize_cairo_surface (GdkWindow *window,
cairo_surface_t *surface,
gint width,
gint height)
{
/* XXX: Make Cairo surface use DC clip */
- cairo_surface_destroy (surface);
-
- return NULL;
+ return FALSE;
}
static void
XDestroyWindow (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XID (window));
}
-static cairo_surface_t *
+static gboolean
gdk_window_x11_resize_cairo_surface (GdkWindow *window,
cairo_surface_t *surface,
gint width,
{
cairo_xlib_surface_set_size (surface, width, height);
- return surface;
+ return TRUE;
}
static void